#include "utils.h"
#include "rules.h"
#include <algorithm>
#include <string>

#ifdef DEBUG
#include <iostream>
#endif

bool rule8(std::string key, bool type_cle) {
    std::string charset = rule1(type_cle);
    for (int i = 0; i < charset.length(); i++) {
        if (std::count(key.begin(), key.end(), charset[i]) > 8) {
#ifdef DEBUG
#pragma omp critical
            std::cerr << key << " - R8 : " << std::count(key.begin(), key.end(), charset[i]) << std::endl;
#endif
            return false;
        }
    }
    return true;
}
